﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SapB1WebPOS.DAL;
using System.Data;
using SapB1WebPOS.Utils;

namespace SapB1WebPOS.BLL
{
    public class CommonBLL
    {
        /// <summary>
        /// Get All Sales Employee
        /// </summary>
        /// <param name="companyDB"></param>
        /// <param name="keySearch"></param>
        /// <returns></returns>
        public DataSet GetAllSalesEmployee(string companyDB, string keySearch)
        {
            try
            {
                DataSet dt = new DataSet();
                CommonDAO bll = new CommonDAO();
                dt = bll.GetAllSalesEmployee(companyDB, keySearch);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get Users
        /// </summary>
        /// <param name="companyDB"></param>
        /// <returns></returns>
        public DataSet GetAllSystemUser(string companyDB, string keySearch)
        {
            try
            {
                DataSet dt = new DataSet();
                CommonDAO bll = new CommonDAO();
                dt = bll.GetAllSystemUser(companyDB,keySearch);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get Employee Master Data
        /// </summary>
        /// <param name="companyDB"></param>
        /// <returns></returns>
        public DataSet GetAllSystemEmployee(string companyDB, string keySearch)
        {
            try
            {
                DataSet dt = new DataSet();
                CommonDAO bll = new CommonDAO();
                dt = bll.GetAllSystemEmployee(companyDB,keySearch);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="companyDB"></param>
        /// <param name="taxDate"></param>
        /// <returns></returns>
        public DataSet GetDisplaySetting(string companyDB)
        {
            try
            {
                DataSet dt = new DataSet();
                CommonDAO bll = new CommonDAO();
                dt = bll.GetDisplaySetting(companyDB);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get Payment Account
        /// </summary>
        /// <param name="companyDB"></param>
        /// <param name="taxDate"></param>
        /// <returns></returns>
        public DataSet GetPaymentAccount(string companyDB, DateTime taxDate)
        {
            try
            {
                DataSet dt = new DataSet();
                CommonDAO bll = new CommonDAO();
                dt = bll.GetPaymentAccount(companyDB, taxDate);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get Obj By Barcode
        /// </summary>
        /// <param name="companyDB"></param>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public DataSet GetObjByBarcode(string companyDB, string barcode)
        {
            try
            {
                DataSet dt = new DataSet();
                CommonDAO bll = new CommonDAO();
                dt = bll.GetObjByBarcode(companyDB, barcode);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get Payment Type
        /// </summary>
        /// <param name="companyDB"></param>
        /// <returns></returns>
        public DataSet GetPaymentType(string companyDB)
        {
            try
            {
                DataSet dt = new DataSet("PaymentType");
                CommonDAO bll = new CommonDAO();
                dt = bll.GetPaymentType(companyDB);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get Tax
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public DataSet GetTax(string companyDB, string category)
        {
            try
            {
                DataSet dt = new DataSet("OVTG");
                CommonDAO bll = new CommonDAO();
                dt = bll.GetOVTG(companyDB, category);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get Wareshouse
        /// </summary>
        /// <returns></returns>
        public DataSet GetWareshouse(string companyDB)
        {
            try
            {
                DataSet dt = new DataSet("OWHS");
                CommonDAO bll = new CommonDAO();
                dt = bll.GetOWHS(companyDB);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        /// <summary>
        /// Get All Company
        /// </summary>
        /// <returns></returns>
        public DataSet GetAllCompany(string companyDB)
        {
            try
            {
                DataSet dt = new DataSet("SRGC");
                CommonDAO bll = new CommonDAO();
                dt = bll.GetAllCompany(companyDB);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
    }
}